package com.hehua.web.observer.demo2;

import java.text.MessageFormat;

public class StockObserver {

    private final String name;

    public StockObserver(String name, EventBus eventBus) {
        this.name = name;
        eventBus.subscribe(BossActionEvent.class,this::handler);
    }
    private void handler(BossActionEvent event){
        String format = MessageFormat.format("{0} {1}关闭股票行情继续工作", event.getAction(), name);
        System.out.println(format);
    }
}
